home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / esc.jar / com / extensibility / xml / DCDWriter$AttrProxy.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-06-30  |  3.5 KB  |  109 lines

  1. package com.extensibility.xml;
  2.  
  3. import com.extensibility.util.StringUtilities;
  4.  
  5. public class DCDWriter$AttrProxy extends DCDWriter.DeclProxy {
  6.    // $FF: synthetic field
  7.    final DCDWriter this$0;
  8.    AttributeDeclaration decl;
  9.  
  10.    DCDWriter$AttrProxy(DCDWriter var1) {
  11.       super((DCDWriter)null);
  12.       this.this$0 = var1;
  13.    }
  14.  
  15.    DCDWriter$AttrProxy(DCDWriter var1, AttributeDeclaration var2) {
  16.       super((DCDWriter)null);
  17.       this.this$0 = var1;
  18.       this.setDecl(var2);
  19.    }
  20.  
  21.    void setDecl(AttributeDeclaration var1) {
  22.       this.decl = var1;
  23.       super.setDecl(var1);
  24.    }
  25.  
  26.    public void write(SXE var1, boolean var2) {
  27.       if (!this.decl.isOwnerDeclared() || this.this$0.isPreviewing()) {
  28.          this.writeType(var1, var2);
  29.       }
  30.  
  31.    }
  32.  
  33.    void writeDataType(SXE var1) {
  34.       String var2;
  35.       if (this.decl.getDataType().isEnumeration()) {
  36.          var2 = "enumeration";
  37.       } else {
  38.          var2 = this.decl.getDataType().getSource().toLowerCase();
  39.       }
  40.  
  41.       if (!this.decl.getDataType().equals(1)) {
  42.          var1.writeAttr("Datatype", var2);
  43.       }
  44.  
  45.       if (this.decl.getDataType().equals(2)) {
  46.          var1.writeAttr("ID-ROLE", "ID");
  47.       } else if (this.decl.getDataType().equals(3)) {
  48.          var1.writeAttr("ID-ROLE", "IDREF");
  49.       } else if (this.decl.getDataType().equals(4)) {
  50.          var1.writeAttr("ID-ROLE", "IDREFS");
  51.       }
  52.  
  53.    }
  54.  
  55.    void writeValues(SXE var1) {
  56.       if (this.decl.getDataType().isEnumeration() || this.decl.getDataType().isNotation()) {
  57.          var1.writeElem("Values", -1);
  58.          var1.writeText(StringUtilities.concat(this.decl.getChoices(this.this$0.schema, true), "", " ", ""));
  59.          var1.flush("Values");
  60.       }
  61.    }
  62.  
  63.    public boolean isGlobal() {
  64.       return this.decl.isGlobal();
  65.    }
  66.  
  67.    void writeGlobalType(SXE var1, boolean var2) {
  68.       this.writeType(var1, var2, true);
  69.    }
  70.  
  71.    void writeType(SXE var1, boolean var2, boolean var3) {
  72.       var1.writeElem("AttributeDef", -1);
  73.       var1.writeAttr("Name", this.decl.getName());
  74.       if (var3) {
  75.          var1.writeAttr("Global", "True");
  76.       }
  77.  
  78.       this.writeDataType(var1);
  79.       if (this.decl.getDefault() != null) {
  80.          if (this.decl.getRequired()) {
  81.             var1.writeAttr("Fixed", this.this$0.schema.expandPERefs(this.decl.getDefault(), this.decl));
  82.          } else {
  83.             var1.writeAttr("Default", this.this$0.schema.expandPERefs(this.decl.getDefault(), this.decl));
  84.          }
  85.       }
  86.  
  87.       if (this.decl.getRequired()) {
  88.          var1.writeAttr("Occurs", "Required");
  89.       }
  90.  
  91.       this.writeValues(var1);
  92.       if (var2) {
  93.          ((DCDWriter.DeclProxy)this).writeComments(var1);
  94.       }
  95.  
  96.       var1.flush("AttributeDef");
  97.    }
  98.  
  99.    void writeType(SXE var1, boolean var2) {
  100.       this.writeType(var1, var2, this.isGlobal());
  101.    }
  102.  
  103.    void writeRef(SXE var1, boolean var2) {
  104.       var1.writeElem("Attribute", -1);
  105.       var1.writeText(DCDWriter.access$2000071(this.this$0, this.decl.getName()));
  106.       var1.flush("Attribute");
  107.    }
  108. }
  109.